package com.example.shopping_web_back.mapper;

import com.example.shopping_web_back.pojo.GoodsImages;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GoodsImagesMapper {

    @Insert("insert into shoppingweb.goods_images (goods_id, goods_image) values (#{id}, #{goodsImage})")
    void addGoodsImages(Integer id, String goodsImage);

    @Delete("delete from shoppingweb.goods_images where goods_image=#{goodsImage}")
    void deleteGoodsImages(String goodsImage);

    @Update("update shoppingweb.goods_images set goods_image=#{newGoodsImages1} where goods_id=#{id} and goods_image=#{oldGoodsImages1}")
    void changeGoodsImages(String oldGoodsImages1, String newGoodsImages1, Integer id);

    @Select("select goods_image from shoppingweb.goods_images where goods_id=#{id}")
    List<GoodsImages> getGoodsImages(Integer id);
}
